<template>
	<view class="media-item view bg-white margin-top-sm" @click="click">
		<view class="text-bold text-xl">{{ newsItem.title }}</view>
		<view class="flex margin-top" :class="newsItem.image_url.length > 0 ? 'with-cover' : ''">
			<view class="basis-lg padding-right-sm">
				<view class="cu-list menu-avatar">
					<view class="cu-item">
						<view class="cu-avatar round"
							:style="'background-image:url(' + newsItem.avatar + ');'">
						</view>
						<view class="content flex-sub">
							<view class="text-gray">{{ newsItem.source }}</view>
						</view>
					</view>
				</view>
				<mp-html class="text-content" :content="newsItem.content" />
			</view>
			<view class="basis-sm" v-if="newsItem.image_url.length > 0">
				<image style="height: 80px;" class="radius" :src="newsItem.image_url" mode="aspectFill"></image>
			</view>
		</view>
		<view class="flex text-gray text-sm justify-between margin-top">
			<view>
				<text>{{ newsItem.comment_count }}</text>评论
				<text class="margin-left-sm">{{ newsItem.praise_count }}</text>收藏
			</view>
			<view>
				<text>{{ newsItem.datetime }}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			newsItem: {
				type: Object,
				default: function(e) {
					return {}
				}
			}
		},
		methods: {
			click() {
				this.$emit('click');
			},
			close(e) {
				e.stopPropagation();
				this.$emit('close');
			}
		}
	}
</script>

<style scoped>
	.cu-list.menu-avatar > .cu-item {
		height: 80rpx;
	}
	.cu-list.menu-avatar > .cu-item > .cu-avatar {
		left: 0;
	}
	.cu-list.menu-avatar > .cu-item .content {
		left: 80rpx;
	}
	.cu-list.menu-avatar > .cu-item:after {
		border-bottom: none;
	}
	.view {
		flex-direction: column;
	}

	.flex-row {
		flex-direction: row;
	}

	.flex-col {
		flex-direction: column;
	}

	.list-cell {
		padding: 0 15px;
	}

	.uni-list-cell-hover {
		background-color: #eeeeee;
	}

	.media-item {
		position: relative;
		flex: 1;
		flex-direction: column;
		padding: 10px 15px 10px 15px;
	}

	.media-item-line {
		position: absolute;
		left: 15px;
		right: 15px;
		bottom: 0;
		height: 1px;
		background-color: #ebebeb;
	}

	.media-image-right {
		flex-direction: row;
	}

	.media-image-left {
		flex-direction: row-reverse;
	}

	.media-title {
		flex: 1;
	}

	.media-title {
		lines: 3;
		text-overflow: ellipsis;
		font-size: 15px;
		color: #555555;
	}

	.media-title2 {
		flex: 1;
		margin-top: 3px;
		line-height: 20px;
	}

	.image-section {
		margin-top: 10px;
		flex-direction: row;
		justify-content: space-between;
	}

	.image-section-right {
		margin-top: 0;
		margin-left: 5px;
		width: 112px;
		height: 73px;
	}

	.image-section-left {
		margin-top: 0;
		margin-right: 5px;
		width: 112px;
		height: 73px;
	}

	.image-list1 {
		height: 240px;
	}

	.image-list2 {
		width: 112px;
		height: 73px;
	}

	.image-list3 {
		width: 112px;
		height: 73px;
	}

	.media-info {
		flex-direction: row;
		align-items: center;
	}

	.info-text {
		margin-right: 10px;
		color: #999999;
		font-size: 12px;
	}

	.media-foot {
		margin-top: 12px;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	.close-view {
		position: relative;
		align-items: center;
		flex-direction: row;
		width: 20px;
		height: 15px;
		line-height: 15px;
		border-width: 1upx;
		border-style: solid;
		border-color: #aaaaaa;
		border-radius: 4px;
		justify-content: center;
		text-align: center;
	}

	.close-l {
		position: absolute;
		width: 9px;
		height: 1px;
		background-color: #aaaaaa;
	}

	.close-h {
		transform: rotate(45deg);
	}

	.close-v {
		transform: rotate(-45deg);
	}
</style>
